package leetcode;

public class LeetCodeM46 {

    int count = 0, n;

    String str;

    public int translateNum(int num) {
        str = String.valueOf(num);
        n = str.length();
        walk(0);
        return count;
    }

    //递归
    private void walk(int index) {
        if (index >= n - 1) {
            count++;
        } else {
            int tmp = Integer.parseInt(str.substring(index, index + 2));
            if (tmp >= 10 && tmp < 26)
                walk(index + 2);
            walk(index + 1);
        }
    }

    //回溯法

//------------------------------------------------------------------
}
